<% content_for :right do %>

<% if admin? %>
<h6><%= 'Admin'[:admin_title] %></h6>
<p><%= link_to 'Create New Forum'[:create_new_forum], new_forum_path, :class => "utility" %></p>
<% end %>

<% end %>

<h1 style="margin-top:0;"><%= 'Forums'[:forums_title] %></h1>
<p class="subtitle">
<%= feed_icon_tag "Recent Posts"[:recent_posts], formatted_posts_path(:format => 'rss') %>
<%= '{count} topic(s)'[(count=Topic.count)==1 ? :topic_count : :topics_count, number_with_delimiter(count)] %>, 
<%= '{count} post(s)'[(count=Post.count)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %>, <%= '{count} voice(s)'[(count=User.count(:conditions => "posts_count > 0"))==1 ? :voice_count : :voices_count, number_with_delimiter(count)] %>
  
</p>

<table border="0" cellspacing="0" cellpadding="0" class="wide forums">
  <tr>
    <th class="la" width="70%" colspan="3"><%= 'Forum'[:forum_title] %></th>
<!--
    <th width="5%">Topics</th>
    <th width="5%">Posts</th>
-->
    <th class="la" width="30%" colspan="1"><%= 'Last Post'[:last_post] %></th>
  </tr>
<% for forum in @forums do %>  
  <tr>
    <td class="vat c1">
    
      <% if recent_forum_activity(forum) %>
      <%= image_tag "clearbits/comment.gif", :class => "icon green", :title => 'Recent activity'[:recent_activity], :plugin => "savage_beast" %>
      <% else %>
      <%= image_tag "clearbits/comment.gif", :class => "icon grey", :title => 'No recent activity'[:no_recent_activity], :plugin => "savage_beast" %>
      <% end %>
    </td>
    <td class="c2 vat">
      <%= link_to h(forum.name), forum_path(forum), :class => "title" %>
      <div class="posts">
        <%= '{count} topics'[(count=forum.topics.size)==1 ? :topic_count : :topics_count, number_with_delimiter(count)] %>, 
        <%= '{count} posts'[(count=forum.posts.size)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %>
      </div>
      <p class="desc"><%= forum.description_html %>
        </p>
    </td>
    <td class="c3">
      <%= link_to 'Edit'[:edit_title], edit_forum_path(forum), :class => "tiny", :rel => "directory", :style => "float:right" if admin? %>
    </td>

    <td class="inv lp">
      <% if forum.recent_post %>
        <%= time_ago_in_words(forum.recent_post.created_at) %><br />
        <%= 'by {user}'[:by_user,"<strong>#{h(forum.recent_post.user.display_name)}</strong>"] %>
        <span>(<%= link_to 'view'[], forum_topic_path(:forum_id => forum, :id => forum.recent_post.topic_id, :page => forum.recent_post.topic.last_page, :anchor => forum.recent_post.dom_id) %>)</span>
      <% end %>
    </td>
  </tr>
<% end %>
</table>

<p>
  <%= link_to 'Recent posts'[:recent_posts], all_posts_path %>
</p>

<% online_users = User.currently_online -%>
<% unless !online_users || online_users.empty? %>
<div class="stats">
<div class="users">
<% unless !online_users || online_users.empty? %>
<%= 'Users online:'[:users_online] %> <%= online_users.map { |u| link_to "<strong>#{h u.display_name}</strong>", user_path(u) } * ", " %><br />
<% end %>
</div>
</div>
<% end %>

